<cfif IsUserInRole("Super User") or IsUserInRole("Regional Admin")>
	<cfinclude template="#request.pathToUI#/grids/sites.cfm" />
<cfelse>

	<div class="row">
		<div class="banner prepare-banner">
			<div class="banner-text">
				<span class="banner-header">Sites</span><br />
			</div>
		</div>
	</div>
	<div class="row body-row">
		<div class="span12 content">
			
			<section id="sites">

				<p><a href="?view=editSite&Site_ID=0" class="btn btn-success">New Site</a></p>
				
				<cfscript>
					siteGateway = new assets.calgrants.com.gateway.SiteGateway();
					sites = siteGateway.query(regionIDs = IIf(IsUserInRole("Regional Admin"), request.authUser.regionID, ""), Organization_ID = IIf(IsUserInRole("Organizer") OR IsUserInRole("Site Contact"), request.authUser.organizationID, ""));
				</cfscript>
				
				<cfif sites.RecordCount gt 0>
				
					<table class="table table-striped table-bordered">
						<thead>
							<tr>
								<th>Site</th>
								<th>Site Type</th>
								<th>Address</th>
								<!--- <th>County</th> --->
								<th>Computers</th>
								<th class="action"></th>
							</tr>
						</thead>
						<tbody>
							<cfoutput query="sites">
								<tr valign="top">
									<td>#Site#</td>
									<td>#Site_Type#</td>
									<td>#Address#<br />#City#, CA #Zip_Code#</td>
									<!--- <td>#County#</td> --->
									<td>#Computers#</td>
									<td><a href="?view=editSite&returnView=#view#&Site_ID=#Site_ID#" class="btn btn-success btn-block">Edit</a></td>
								</tr>
							</cfoutput>
						</tbody>
					</table>
					
				<cfelse>
					<div class="alert alert-info notFound">No sites</div>
				</cfif>

			</section>
		</div>
	</div>
	
</cfif>